<template>
  <view class="comp-a">
    <view class="title">子组件A</view>
    <view>父组件传进来的值: <text style="color: red;">{{ intent }}</text></view>
    <button @click="sendToCompB" style="background: #1677ff; color: #fff; padding: 10rpx 20rpx; margin-top: 10rpx;">
      传值给CompB组件
    </button>
  </view>
</template>
<script>
export default {
  props: {
    intent: {
      type: String,
      default: ""
    }
  },
  methods: {
    sendToCompB() {
      this.$emit("sendToCompB", this.intent);
    }
  }
};

</script>

<style scoped>
.comp-a {
  background: #f9a825;
  padding: 20rpx;
  margin: 20rpx 0;
  color: #000;
}
.title {
  font-size: 32rpx;
  font-weight: bold;
  margin-bottom: 10rpx;
}
</style>